package com.devilvan.betrice.recruitment.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.devilvan.betrice.common.BasePo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import lombok.experimental.Accessors;
import org.hibernate.annotations.DynamicInsert;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import java.io.Serial;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

/**
 * @author Evad.Wu
 * @Description Boss直聘 福利信息映射
 * @date 2022-08-06
 */
@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@ToString(exclude = {"jobs"})
@EqualsAndHashCode(callSuper = true, exclude = {"jobs"})
@TableName(value = "BOSS_WELFARE")

@Entity
@Table(name = "BOSS_WELFARE")
@DynamicInsert
@Schema(description = "Boss直聘 福利信息映射")
public class BossWelfarePo extends BasePo implements Serializable {
    @Serial
    private static final long serialVersionUID = 593849735298537097L;

    @Schema(description = "福利待遇")
    @Column(name = "WELFARE", unique = true)
    @TableField(value = "WELFARE")
    private String welfare;

    public BossWelfarePo(String welfare) {
        this.welfare = welfare;
    }

    @Schema(description = "招聘信息")
    @TableField(exist = false)
    @ManyToMany(mappedBy = "welfares")
    private Set<BossJobPo> jobs = new HashSet<>(0);
}
